/**
 * @author ZCR
 * @create 2025/9/5 22:44
 */
public class Solution1796 {
    public int secondHighest(String s) {
        int first = -1, second = -1;
        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) >= '0' && s.charAt(i) <= '9') {
                int digit = s.charAt(i) - '0';
                if (digit > first) {
                    second = first;
                    first = digit;
                } else if (digit < first && digit > second) {
                    second = digit;
                }
            }
        }
        return second;
    }

    public static void main(String[] args) {
        Solution1796 solution = new Solution1796();
        System.out.println(solution.secondHighest("sjhtz8344"));
        System.out.println(solution.secondHighest("sjhtz111"));
    }
}
